<template>
  <div>
    <dynamicTable
      ref="dynamicTable"
      :columns="columns"
      :get-list-func="onLoadData"
      rowKey="id"
      type="selection"
      border
      @selection-change="onSelectChangeFun"
    >
      <!-- <template #title>
        <span>自定义表头</span>
      </template> -->
      <!-- <template #createdTime="{ row }">
        自定义的slot{{ row.id === 1 ? 'hahhah' : row.id }}
      </template> -->
    </dynamicTable>
  </div>
</template>

<script>
import dynamicTable from '@/components/dynamicTable'
import { columns } from './columns.js'
import wishApi from '@/api/wish/wish.js'
export default {
  name: 'Table',
  components: {
    dynamicTable
  },
  data() {
    return {
      columns: columns,
      rowSelection: {
        selectedKeys: [],
        selectedRows: []
      }
    }
  },
  // created () {
  //   this.$nextTick(() => {
  //     console.log(this.$refs.dynamicTable)
  //   })
  // },
  methods: {
    onSelectChangeFun(selection) {
      console.log(selection)
    },
    // onEdit(row) {
    //   console.log(row)
    //   console.log(row.id)
    // },
    onLoadData(params) {
      return wishApi.getList(params)
    }
  }
}
</script>
